<?php $this->load->view('common/head');?>
<form class="form-horizontal" name="add" id="add" action="<?php echo $this->input->server('REQUEST_URI'); ?>" method="post">
  <input type="hidden" name="id" id="id" value="<?=isset($netData) ? $netData['id'] : ''?>">
  <input type="hidden" name="procId" id="procId" value="<?=$procId?>">
  <input type="hidden" name="isBubao" id="isBubao" value="<?=$isBubao?>">
  <table class="table table-condensed table-bordered mb27" style="width: 350px; margin:0 auto;">
        <tbody>
          <tr>
            <td class="bg-primary">项目主题</td>
            <td>
              <input type="input" required class="form-control" name="theme" id="theme" value="<?=isset($netData['theme']) ? $netData['theme'] : '天网行动'?>" placeholder="项目主题">
            </td>
          </tr>
          <tr>
            <td class="bg-primary">标准动作</td>
            <td>
            <select class="form-control" required placeholder="" id="actionType" name="actionType">
              <option value="">请选择</option>
            </select>
            </td>
          </tr>
          <tr>
            <td class="bg-primary">媒体名称</td>
            <td>
            <input type="input" class="form-control" required name="mediaName" id="mediaName" value="<?=isset($netData['mediaName']) ? $netData['mediaName'] : '天网行动'?>" placeholder="媒体名称">
            </td>
          </tr>
          <tr>
            <td class="bg-primary">开始时间</td>
            <td>
            <input type="input" class="form-control" required onFocus="WdatePicker({minDate:'<?=$this->timeUnitModel->getTimeUnitStartDate($procData['timeUnit'], $procData['year'])?>',maxDate:'#F{$dp.$D(\'endTime\')||\'<?=$this->timeUnitModel->getTimeUnitEndDate($procData['timeUnit'], $procData['year'])?>\'}'})" name="startTime" id="startTime" value="<?=isset($netData) ? $netData['startTime'] : ''?>" placeholder="开始时间">
            </td>
          </tr>
          <tr>
            <td class="bg-primary">结束时间</td>
            <td>
            <input type="input" class="form-control" required onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\')||\'<?=$this->timeUnitModel->getTimeUnitStartDate($procData['timeUnit'], $procData['year'])?>\'}',maxDate:'<?=$this->timeUnitModel->getTimeUnitEndDate($procData['timeUnit'], $procData['year'])?>'})" name="endTime" id="endTime" value="<?=isset($netData) ? $netData['endTime'] : ''?>" placeholder="结束时间">
            </td>
          </tr>
          <tr>
            <td class="bg-primary">发布频次</td>
            <td>
            <input type="number" class="form-control" name="frequency" id="frequency" value="<?=(float)$netData['frequency'] ? $netData['frequency'] : 1?>" placeholder="发布频次">
            </td>
          </tr>
          <tr>
            <td class="bg-primary">预算费用</td>
            <td>
            <?=isset($netData['budgetApply']) ? $netData['budgetApply'] : ''?>
            <input type="hidden" class="form-control" name="budgetApply" id="budgetApply" value="<?=(float)$netData['budgetApply'] ? $netData['budgetApply'] : ''?>" placeholder="预算费用">
            </td>
          </tr>
          <tr>
            <td class="bg-primary"></td>
            <td>

            </td>
          </tr>
          <tr>
            <td colspan="2" align="center">
              <button type="submit" class="btn btn-default btn-primary">提交</button>
              <button type="button" onclick="closeWindow()" class="btn btn-default btn-primary">取消</button>
            </td>
          </tr>
          </tbody>
        </table>
</form>
<script type="text/javascript">
$(function(){
  initValidation();
	loadNetActionType(<?=isset($netData['actionType']) ? $netData['actionType'] : ''?>);
});
function loadNetActionType(sec){
	$.post(
		"index.php?c=Ajax&m=loadNetActionType",
		{
			
		},
		function(data){
			var html = '';
			$.each(data,function(i, n){
				if (n.key==sec) {
					html += '<option value="'+n.key+'" selected="selected">'+n.value+'</option>'+"\r\n";
				}else{
					html += '<option value="'+n.key+'">'+n.value+'</option>'+"\r\n";
				}
			});
			if (html) {
				$("#actionType").html(html);
			}
		},'json'
	);
}
//初始化验证
function initValidation(){
  $('form[name="add"]').find("input,select,textarea").jqBootstrapValidation("destroy");
  $('form[name="add"]').find("input,select,textarea").not("[type=submit]").jqBootstrapValidation({
      preventSubmit:false,
      submitSuccess: function (form, event) {
           event.preventDefault();
           ajaxFormSubmit('add');
       },
       submitError: function (form, event, errors) {
         event.preventDefault();
         }
    });
}
</script>
<?php $this->load->view('common/foot');?>